﻿using System;
using System.Text.RegularExpressions;
using ICSharpCode.AvalonEdit.Rendering;

namespace JiveMessenger.AvalonEdit
{
    class ImageZoomLinkElementGenerator : LinkElementGenerator
    {

        public ImageZoomLinkElementGenerator(Regex reg) : base(reg)
        {
            this.RequireControlModifierForClick = false;
            

        }

        protected override VisualLineElement ConstructElementFromMatch(Match m)
        {
            Uri uri = GetUriFromMatch(m);
            if (uri == null)
                return null;
            ImageZoomVisualLineLinkText linkText = new ImageZoomVisualLineLinkText(CurrentContext.VisualLine, m.Length);
            linkText.NavigateUri = uri;
            linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
            return linkText;
        }
    }
}
